#include <iostream>
using namespace std;

class Student {
public:
	Student (const string& name, int no):m_name(name),m_no(no) {}
	string m_name;
	int m_no;
	int m_age;
};

int main (void)
{
	string Student::*pname = &Student::m_name;
	int Student::*pno = &Student::m_no;
	int Student::*page = &Student::m_age;
	Student s1("loooooooooooooooooooooooooooooooooooooooooooooooooooooooooong", 10000);
	Student *ps = &s1;
	cout << s1.*pname << endl;
	cout << ps->*pname << endl;

	//s1.m_name = &s1 + pname;
	//pname 保存的是一个变量在对象中的相对地址
	printf ("pname = %p\n",pname);
	printf ("pno = %p\n",pno);
	printf ("page = %p\n",page);
	printf ("&s1.m_name = %p\n", &s1.m_name);
	printf ("&s1.m_no = %p\n", &s1.m_no);
	printf ("&s1.m_age = %p\n", &s1.m_age);
	printf ("&s1 = %p\n", &s1);

	return 0;
}
